package controllayer;



import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class OrdreControllerTest.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class OrdreControllerTest
{
    /**
     * Default constructor for test class OrdreControllerTest
     */
    public OrdreControllerTest()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
        
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
        modellayer.SalgsContainer sContainer = modellayer.SalgsContainer.getInstance();
        sContainer.clearList();
    }
    
    
    @Test
    public void createSalgWithSameIDTest()
    {
        controllayer.OrdreController oController = controllayer.OrdreController.getInstance();
        assertEquals(true, oController.createSalg("1", "testDato"));
        assertEquals(false, oController.createSalg("1", "testDato"));
        oController.completeSalg();
    }
    
    @Test
    public void salgExistTest()
    {
        controllayer.OrdreController oController = controllayer.OrdreController.getInstance();
        assertEquals(false, oController.addKunde("testPhone"));
        assertEquals(false, oController.addDelSalg("TestStregkode", 12));
        oController.createSalg("2","TestDato");
        assertEquals(true, oController.addKunde("testPhone"));
        assertEquals(true, oController.addDelSalg("TestStregkode", 12));
    }
    
}

